scope
XBasic variables can choose from a complete set of scopes:
░ AUTO
░ AUTOX
░ STATIC
░ SHARED
░ SHARED /groupname/
░ EXTERNAL
░ EXTERNAL /groupname/
operators
XBasic supports complete sets of arithmetic, bitwise, logical, shift, and address
operators, including:
& and && address operators
<<< and >>> arithmetic shifts
<< and >> bitwise shifts
! !! && ^^ || logical NOT, TEST, AND, XOR, OR
bitfields
XBasic supports a readable, efficient, machine independent mechanism for creating bitfield
definitions. Bitfields can be created, cleared, set, and extracted from numeric variables
efficiently. For example, $$TYPE = BITFIELD(5,20) defines a 5-bit wide bitfield starting
at bit 20. newType = part{$$TYPE} extracts an unsigned bitfield from part and assigns it
to newType . newType = part{{$$TYPE}} extracts a signed bitfield. Bitfield operations are
so efficient that the preceding examples take only one machine cycle on some CPUs.
strings
XBasic string variables automatically resize to hold whatever length string is assigned to
them. A wealth of instrinsics and functions are provided to support efficient string
processing. Furthermore, XBasic supports brace notation for assigning and extracting
single bytes of strings efficiently. For example, a=ASC(MID$(x$,y,1)) is the QuickBASIC
way to extract a single byte from string x$ . This also works in XBasic, but two faster
alternatives are available, a=ASC(x$,y) , and a=x${y} . The first alternative is 10 to 50
times faster than the conventional technique, while the second is hundreds of times
faster, taking only one machine cycle on some CPUs. The assignment form of brace notation
is also fast, as in the x${y}=a alternative to MID$(x$,y,1)=CHR$(a).
arrays
XBasic arrays can contain variables of any data type, including strings and composite
types. All arrays, even multi-dimensional arrays, can be redimensioned without altering
the contents.
Furthermore, XBasic multi-dimensional arrays are tree structures. When used in
conventional ways, the difference is invisible. But a wide variety of very common problems
that are impossible to solve with previous BASICs, are solved simply and efficiently with
XBasic tree-structure array features. There's no need to resort to addresses, pointers,
indirection, or explicit memory allocation to write programs to handle arbitrarily varying
quantities and types of data.